package com.wjh.controler;

import com.wjh.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ControlForm {
    @RequestMapping("/login1")
    public ModelAndView login( @RequestParam(value = "username",required = true,defaultValue = "gge")String username){
        ModelAndView modelAndView=new ModelAndView();
        System.out.println(username);
        User user=new User();
        user.setMobile("45842");
        user.setUsername(username);
        modelAndView.setViewName("index");
        modelAndView.addObject(user);
        return modelAndView;

    }
    @RequestMapping(value = "login2")
    public String login2(ModelMap map){
        map.addAttribute("username","zhemoshenqi");
        return "index";
    }
}
